﻿using System.Data;

namespace Codemonk.Common.Data
{
    public interface IDbConnectionCreater
    {
        bool AutoOpen
        {
            get;
            set;
        }

        /// <summary>
        /// 设置连接字符串
        /// </summary>
        string ConnectionString
        {
            get;
            set;
        }

        System.Data.Common.DbConnectionStringBuilder CreateConnectionStringBuilder();


        IDbConnection DefaultConnection
        {
            get;
        }
        void Open(IDbConnection connection = null);
        void Close(IDbConnection connection = null);
        IDbConnection CreateConnection();
        IDbConnection CreateConnection(string connectionString);

        IDbTransaction BeginTransaction();
        IDbTransaction BeginTransaction(IsolationLevel iso);
        IDbTransaction BeginTransaction(IDbConnection connection);
        IDbTransaction BeginTransaction(IDbConnection connection, IsolationLevel iso);
    }
}
